﻿using EntityModels.Entities;
using Microsoft.EntityFrameworkCore;


namespace EntityModels.DbContexts
{
    /// <summary>
    /// 自定义实体模型注解
    /// </summary>
    public class AnnotationDbContext : DbContext
    {
        public DbSet<AnnotationEntity> AnnotationEntities => Set<AnnotationEntity>();

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<AnnotationEntity>(b =>
            {
                b.Property(q => q.Text)
                .HasAnnotation("MyAnnotation", "CustomValue");
            });
        }
    }
}
